/*******************************************************************************
 * $Header: /cvsroot/oloa/org.gocom.bpm.platform.model/src/org/gocom/bpm/platform/model/web/taglib/StateImpl.java,v 1.1 2011/07/03 02:30:16 hufulai Exp $
 * $Revision: 1.1 $
 * $Date: 2011/07/03 02:30:16 $
 *
 *==============================================================================
 *
 * Copyright (c) 2001-2006 Primeton Technologies, Ltd.
 * All rights reserved.
 * 
 * Created on 2010-5-26
 *******************************************************************************/

package com.atozsoft.wf.taglib;

import java.util.HashMap;
import java.util.Map;

import com.primeton.workflow.model.definition.Activity;


public class StateImpl implements State{
    private String currentState;
    private String id;
    private String name;
    private String type;
    private String description;
    private int x;
    private int y;
    private int Width;
    private int Height;
    private Object mouseEvents;
    private String imgSrc;
    private Map extendAttribute;
    

    public String getImgSrc()
    {
        return imgSrc;
    }

    public void setImgSrc(String imgSrc)
    {
        this.imgSrc = imgSrc;
    }

    public StateImpl(Activity activityDef)
    {
        currentState = String.valueOf(1);
        extendAttribute = new HashMap();
        try
        {
            x = Integer.parseInt((String)activityDef.getExtendAttribute().get("x"));
            y = Integer.parseInt((String)activityDef.getExtendAttribute().get("y"));
            Height = Integer.parseInt((String)activityDef.getExtendAttribute().get("height"));
            Width = Integer.parseInt((String)activityDef.getExtendAttribute().get("width"));
        }
        catch(NumberFormatException e)
        {
            e.printStackTrace();
        }
        id = activityDef.getId();
        name = activityDef.getName();
        type = activityDef.getType();
        description = activityDef.getDescription();
        getExtendAttribute().put("activityDefID", activityDef.getId());
    }

    public String getID()
    {
        return id;
    }

    public String getType()
    {
        return type;
    }

    public String getCurrentState()
    {
        return currentState;
    }

    public void setCurrentState(String currentState)
    {
        this.currentState = currentState;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getDescription()
    {
        return description;
    }

    public int getX()
    {
        return x;
    }

    public void setX(int x)
    {
        this.x = x;
    }

    public int getY()
    {
        return y;
    }

    public void setY(int y)
    {
        this.y = y;
    }

    public int getWidth()
    {
        return Width;
    }

    public int getHeight()
    {
        return Height;
    }

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public Object getMouseEvents()
    {
        return mouseEvents;
    }

    public void setMouseEvents(Object mouseEvents)
    {
        this.mouseEvents = mouseEvents;
    }

    public String toString()
    {
        String ret = "";
        ret = (new StringBuilder()).append(ret).append(" id = ").append(getID()).toString();
        ret = (new StringBuilder()).append(ret).append(" type = ").append(getType()).toString();
        ret = (new StringBuilder()).append(ret).append(" name = ").append(getName()).toString();
        ret = (new StringBuilder()).append(ret).append(" CurrentState = ").append(getCurrentState()).toString();
        ret = (new StringBuilder()).append(ret).append(" x = ").append(String.valueOf(x)).toString();
        ret = (new StringBuilder()).append(ret).append(" y = ").append(String.valueOf(y)).toString();
        ret = (new StringBuilder()).append(ret).append(" Width = ").append(String.valueOf(Width)).toString();
        ret = (new StringBuilder()).append(ret).append(" Height = ").append(String.valueOf(Height)).toString();
        return ret;
    }

    public void setMouseEvents(String mouseEvents)
    {
        this.mouseEvents = mouseEvents;
    }

    public Map getExtendAttribute()
    {
        return extendAttribute;
    }

    public void setExtendAttribute(Map extendAttributes)
    {
        extendAttribute = extendAttributes;
    }


}
